/*
 * main.cpp
 *
 *  Created on: May 12, 2011
 *      Author: skyang
 */
#include <fstream>
#include <iostream>
//#include <vector>
//#include "InputArray.h"
#include "apAEPD.h"
#include "specialfunctions.h"
#include "AEPD_Dist.h"
#include "InputArray.h"
#define N 500
using namespace std;
using namespace alglib;

int main(){
	/***********************************************************
	 * Test the log gamma function vs. the log gamma function from specialfunctions.cpp
	 ***********************************************************/
/*
	double * testVector;
	testVector = (double *) malloc ( 100 * sizeof(double) );
	for (int i = 0; i<100; i++){
		testVector[i] = 10+ i*0.05;
	}
	double sgngam = 0;
	for (int i = 0; i< 100; i++){
		cout <<"log gamma of " << testVector[i] << " = "<< lngamma(testVector[i],sgngam) <<
			"            local log gamma of " << testVector[i] << " = " << locallngamma(testVector[i], &sgngam)<< endl;
	}
*/

	InputArray InArray = InputArray(N);

	fstream myfile("gbpusd.txt", ios::in);
	InArray.InitiateArray(myfile);
	double * param;
	param = (double *) malloc (4 * sizeof(double));

	/********************************
	 * Test AEPD_Fit vs. Local version of AEPD_Fit
	 ********************************/
	// First the one Aleks wrote
	AEPD_Fit(InArray.CurrentArray, N, param);
	cout<< "Parameters from AEPD_Fit" << endl;
	for (int i = 0; i<4; i++){
		cout << "Param[" << i << "] = " << param[i]<<endl;
	}

	// Now my local one

	cout<< "Parameters from localAEPD_Fit" << endl;
	localAEPD_Fit(InArray.CurrentArray, N, param);
	for (int i = 0; i<4; i++){
		cout << "Param[" << i << "] = " << param[i]<<endl;
	}

}
